package demo1;


// 外观模式：为子系统中的一组接口提供一个一致的界面，此模式定义了一个高层接口，这个接口使得这一子系统更加容易使用
public class Main {
    public static void main(String[] args) {
        Facade facade = new Facade();
        facade.MethodA();
        facade.MethodB();
    }
}

class SubSystemOne{
    public void MethodOne(){
        System.out.println("子系统方法一");
    }
}

class SubSystemTwo{
    public void MethodTwo(){
        System.out.println("子系统方法二");
    }
}

class SubSystemThree{
    public void MethodThree(){
        System.out.println("子系统方法三");
    }
}

class SubSystemFour{
    public void MethodFour(){
        System.out.println("子系统方法四");
    }
}

class Facade{
    //外观类
    SubSystemOne subSystemOne;
    SubSystemTwo subSystemTwo;
    SubSystemThree subSystemThree;
    SubSystemFour subSystemFour;
    //构造函数
    public Facade() {
        subSystemOne = new SubSystemOne();
        subSystemTwo = new SubSystemTwo();
        subSystemThree = new SubSystemThree();
        subSystemFour = new SubSystemFour();
    }
    public void MethodA(){
        System.out.println("\n 方法组A() ----");
        subSystemOne.MethodOne();
        subSystemTwo.MethodTwo();
        subSystemFour.MethodFour();
    }
    public void MethodB(){
        System.out.println("\n 方法组B() ----");
        subSystemTwo.MethodTwo();
        subSystemThree.MethodThree();
    }
}